//
//  Tabbar_view.m
//  XiAnJMApp
//
//  Created by Kai Wang on 2017/5/23.
//  Copyright © 2017年 Kai Wang. All rights reserved.
//

#import "Tabbar_view.h"
#import "Common.h"

#define WIDTH_Lab  ScreenWidth/5.0
#define HEIGHT_Lab  20
#define WIDTH_ImgV  25
#define HEIGHT_Tabbar 50

@interface Tabbar_view ()
/*
 * 品种详情
 */
@property(nonatomic,strong)UIImageView * imgV_Detail;
@property(nonatomic,strong)UILabel     * lab_Detail;

/*
 * 成交
 */
@property(nonatomic,strong)UIImageView * imgV_Bargain;
@property(nonatomic,strong)UILabel     * lab_Bargain;

/*
 * 交易
 */
@property(nonatomic,strong)UIImageView * imgV_Transaction;
@property(nonatomic,strong)UILabel     * lab_Transaction;

/*
 * 查询
 */
@property(nonatomic,strong)UIImageView * imgV_Inquire;
@property(nonatomic,strong)UILabel     * lab_Inquire;

/*
 * 设置
 */
@property(nonatomic,strong)UIImageView * imgV_Set;
@property(nonatomic,strong)UILabel     * lab_Set;


@end

@implementation Tabbar_view
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        [self createUI];
        
    }
    return self;
}

-(void)createUI{
    
    
    CGFloat centerY_ImgV=(HEIGHT_Tabbar-HEIGHT_Lab)/2.0;
    
    
    /*
     * 品种详情
     */
    _lab_Detail=[[UILabel alloc]init];
    _lab_Detail.text=@"品种详情";
    _lab_Detail.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_lab_Detail];
    [_lab_Detail mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.equalTo(self.mas_bottom).offset(0);
        make.left.equalTo(self.mas_left).offset(0);
        make.width.mas_equalTo(WIDTH_Lab);
        make.height.mas_equalTo(HEIGHT_Lab);
        
    }];
    
    _imgV_Detail=[[UIImageView alloc]init];
    _imgV_Detail.backgroundColor=[UIColor  cyanColor];
    _imgV_Detail.image=[UIImage imageNamed:@"icon1"];
    [self addSubview:_imgV_Detail];
    [_imgV_Detail mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(self.mas_left).offset(WIDTH_Lab/2.0);
        make.centerY.equalTo(self.mas_top).offset(centerY_ImgV);
        make.width.mas_equalTo(WIDTH_ImgV);
        make.height.mas_equalTo(WIDTH_ImgV);
        
    }];
    
    

    /*
     * 成交
     */
    _lab_Bargain=[[UILabel alloc]init];
    _lab_Bargain.text=@"成交";
    _lab_Bargain.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_lab_Bargain];
    [_lab_Bargain mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.equalTo(self.mas_bottom).offset(0);
        make.left.equalTo(_lab_Detail.mas_right).offset(0);
        make.width.mas_equalTo(WIDTH_Lab);
        make.height.mas_equalTo(HEIGHT_Lab);
        
    }];
    
    _imgV_Bargain=[[UIImageView alloc]init];
    _imgV_Bargain.image=[UIImage imageNamed:@"icon1"];
    [self addSubview:_imgV_Bargain];
    [_imgV_Bargain mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_left).offset(WIDTH_Lab/2.0+WIDTH_Lab);
        make.centerY.equalTo(self.mas_top).offset(centerY_ImgV);
        make.width.mas_equalTo(WIDTH_ImgV);
        make.height.mas_equalTo(WIDTH_ImgV);
        
    }];
    
    
    
    /*
     * 交易
     */
    _lab_Transaction=[[UILabel alloc]init];
    _lab_Transaction.text=@"交易";
    _lab_Transaction.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_lab_Transaction];
    [_lab_Transaction mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.equalTo(self.mas_bottom).offset(0);
        make.left.equalTo(_lab_Bargain.mas_right).offset(0);
        make.width.mas_equalTo(WIDTH_Lab);
        make.height.mas_equalTo(HEIGHT_Lab);
        
    }];
    
    _imgV_Transaction=[[UIImageView alloc]init];
    _imgV_Transaction.image=[UIImage imageNamed:@"icon1"];
    [self addSubview:_imgV_Transaction];
    [_imgV_Transaction mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_left).offset(WIDTH_Lab/2.0+WIDTH_Lab*2);
        make.centerY.equalTo(self.mas_top).offset(centerY_ImgV);
        make.width.mas_equalTo(WIDTH_ImgV);
        make.height.mas_equalTo(WIDTH_ImgV);
        
    }];
    
    
    /*
     * 查询
     */
    _lab_Inquire=[[UILabel alloc]init];
    _lab_Inquire.text=@"查询";
    _lab_Inquire.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_lab_Inquire];
    [_lab_Inquire mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.equalTo(self.mas_bottom).offset(0);
        make.left.equalTo(_lab_Transaction.mas_right).offset(0);
        make.width.mas_equalTo(WIDTH_Lab);
        make.height.mas_equalTo(HEIGHT_Lab);
        
    }];
    
    _imgV_Inquire=[[UIImageView alloc]init];
    _imgV_Inquire.image=[UIImage imageNamed:@"icon1"];
    [self addSubview:_imgV_Inquire];
    [_imgV_Inquire mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_left).offset(WIDTH_Lab/2.0+WIDTH_Lab*3);
        make.centerY.equalTo(self.mas_top).offset(centerY_ImgV);
        make.width.mas_equalTo(WIDTH_ImgV);
        make.height.mas_equalTo(WIDTH_ImgV);
        
    }];
    
    
    /*
     * 设置
     */
    _lab_Set=[[UILabel alloc]init];
    _lab_Set.text=@"设置";
    _lab_Set.textAlignment=NSTextAlignmentCenter;
    [self addSubview:_lab_Set];
    [_lab_Set mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.bottom.equalTo(self.mas_bottom).offset(0);
        make.left.equalTo(_lab_Inquire.mas_right).offset(0);
        make.width.mas_equalTo(WIDTH_Lab);
        make.height.mas_equalTo(HEIGHT_Lab);
        
    }];
    
    _imgV_Set=[[UIImageView alloc]init];
    _imgV_Set.image=[UIImage imageNamed:@"icon1"];
    [self addSubview:_imgV_Set];
    [_imgV_Set mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_left).offset(WIDTH_Lab/2.0+WIDTH_Lab*4);
        make.centerY.equalTo(self.mas_top).offset(centerY_ImgV);
        make.width.mas_equalTo(WIDTH_ImgV);
        make.height.mas_equalTo(WIDTH_ImgV);
        
    }];
    
}


@end






































